﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Campus.Main.Basic;

namespace Campus.Main.ReadWriteUser
{
    public partial class ReportForReadUser : Report1
    {
        public ReportForReadUser()
        {
            InitializeComponent();
        }

        public ReportForReadUser(int a):base()
        {
            InitializeComponent();
            button3.Click += button3_Click;
            btn_uyr_o.Click += btn_uyr_o_Click;
        }

        protected override void button3_Click(object sender, EventArgs e)
        {
            if (checkBox10.Checked)
            {
                q2 += " and b.id =" + Convert.ToString(comboBox3.SelectedValue);
            }
            if (checkBox9.Checked)
            {
                q2 += " and a.nation_id =" + Convert.ToString(comboBox2.SelectedValue);
            }
            if (checkBox8.Checked)
            {
                q2 += " and a.Cource_id =" + Convert.ToString(comboBox1.SelectedValue);
            }
            if (checkBox7.Checked)
            {
                if (rbt_burs_ok_k.Checked)
                {
                    q2 += " and a.oratalama>=2.5";
                }
                if (rbt_burs_can_k.Checked)
                {
                    q2 += " and a.oratalama<2.5";
                }
            }
            if (checkBox6.Checked)
            {
                if (rbt_pol_e_k.Checked)
                {
                    q2 += " and a.pol_id=1";
                }
                if (rbt_pol_k_k.Checked)
                {
                    q2 += " and a.pol_id=2";
                }
            }
            aToDb.AddItemDBGridView(dataGridView1, q2);
            ListView f=new ListView(q2);
            f.ShowDialog();
            Initialize();
        }

        protected override void btn_uyr_o_Click(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                q1 += " and b.id =" + Convert.ToString(cmb_fak_list_o.SelectedValue);
            }
            if (checkBox2.Checked)
            {
                q1 += " and a.nation_id =" + Convert.ToString(cmb_uyr_list_o.SelectedValue);
            }
            if (checkBox3.Checked)
            {
                q1 += " and a.Cource_id =" + Convert.ToString(cmb_cource_list_o.SelectedValue);
            }
            if (checkBox4.Checked)
            {
                if (rbt_burs_ok_o.Checked)
                {
                    q1 += " and a.oratalama>=2.5";
                }
                if (rbt_burs_can_o.Checked)
                {
                    q1 += " and a.oratalama<2.5";
                }
            }
            if (checkBox5.Checked)
            {
                if (rbt_uyr_e_o.Checked)
                {
                    q1 += " and a.pol_id=1";
                }
                if (rbt_uyr_k_o.Checked)
                {
                    q1 += " and a.pol_id=2";
                }
            }
            aToDb.AddItemDBGridView(dataGridView1, q1);
            if (dataGridView1.RowCount > 0)
            {
                ListView f = new ListView(q1);
                f.ShowDialog();
                Initialize();

            }
            else
            {
                MessageBox.Show("Берилиштер базасында жок");
                Initialize();
            }
            
        }
    }
}
